From c6c50bbe4c7c2856380796b1b7e042f342a7afee Mon Sep 17 00:00:00 2001 From: justbur Date: Tue, 7 Jul 2015 15:11:46 -0400 Subject: [PATCH] Make echo-keystrokes a variable and speed it up. --- which-key.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/which-key.el b/which-key.el index 1d2c7586ca8..8c4317e25a0 100644 --- a/which-key.el +++ b/which-key.el @@ -29,6 +29,12 @@ "Delay (in seconds) for which-key buffer to popup.") ;; (defvar which-key-close-buffer-idle-delay 4 ;; "Delay (in seconds) after which buffer is forced closed.") +(defvar which-key-echo-keystrokes + (min echo-keystrokes (/ (float which-key-idle-delay) 4)) + "Value to use for echo-keystrokes. This only applies when +`which-key-popup-type' is minibuffer. It needs to be less than +`which-key-idle-delay' or else the echo will erase the which-key +popup.") (defvar which-key-max-description-length 27 "Truncate the description of keys to this length. Also adds \"..\".") @@ -107,12 +113,11 @@ Used when `which-key-popup-type' is frame.") (if which-key-mode (progn (unless which-key--setup-p (which-key/setup)) - ;; reduce echo-keytrokes for minibuffer popup + ;; reduce echo-keystrokes for minibuffer popup ;; (it can interfer if it's too slow) (when (and (> echo-keystrokes 0) (eq which-key-popup-type 'minibuffer)) - (setq echo-keystrokes - (min echo-keystrokes (/ (float which-key-idle-delay) 2))) + (setq echo-keystrokes which-key-echo-keystrokes) (message "Which-key-mode enabled (note echo-keystrokes changed from %s to %s)" which-key--echo-keystrokes-backup echo-keystrokes)) (add-hook 'pre-command-hook #'which-key/hide-popup) -- 2.30.2